#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#define N  10

int BSearch(int[], int, int);

int main() {
    int R[N], n;
    int pos, k;

    while (~scanf("%d", &n)) {
        for (int i = 0; i < n; i++)
            scanf_s("%d", &R[i]);  // Enter n integers in ascending order
        scanf_s("%d", &k);        // Input the integer k to search for
        pos = BSearch(R, n, k); // Call the binary search function
        printf("%d\n", pos);
    }

    return 0;
}

int BSearch(int R[], int n, int x) { // Binary search function
    int pos = -1;  // Initialize pos to -1 (not found)
    int low = 0, high = n - 1, mid;

    while (low <= high) {
        mid = (low + high) / 2; // Calculate mid index
        if (R[mid] == x) {      // Check if the middle element is x
            pos = mid;          // Found x, store the position
            break;
        }
        if (R[mid] > x)        // If x is smaller, ignore the right half
            high = mid - 1;
        else                    // If x is larger, ignore the left half
            low = mid + 1;
    }

    return pos;
}
